package com.topscore.uke.mvp.model;

import android.os.Handler;

import com.topscore.uke.mvp.contractors.MemberBoundContractor;

public class MemberBoundModel implements MemberBoundContractor.Model {
    private CallBack mCallBack;

    public MemberBoundModel(CallBack callBack) {
        this.mCallBack = callBack;
    }

    @Override
    public void getVerify() {
        Handler handler = new Handler(message -> {
            mCallBack.onComplete();
            switch (message.what) {
                case 0:
                    mCallBack.onGetCodeSuccess();
                    break;
                case 1:
                    mCallBack.onError(-1, "获取失败");
                    break;
            }
            return false;
        });
        handler.sendEmptyMessageDelayed(0, 1000);
    }

    @Override
    public void bindMember() {
        Handler handler = new Handler(message -> {
            mCallBack.onComplete();
            switch (message.what) {
                case 0:
                    mCallBack.onPostSuccess();
                    break;
                case 1:
                    mCallBack.onError(-1, "提交失败");
                    break;
            }
            return false;
        });
        handler.sendEmptyMessageDelayed(0, 1000);
    }
}
